{
  "$schema" : "http://json-schema.org/draft/2019-09/schema#",
  "title" : "Rated Charge",
  "type" : "object",
  "additionalProperties" : false,
  "properties" : {
    "interfaceCategory" : {
      "type" : "string",
      "maxLength" : 20,
      "enum" : [ "Billing" ],
      "description" : "CMP categorization of the job."
    },
    "interfaceType" : {
      "type" : "string",
      "maxLength" : 20,
      "enum" : [ "Rated Charge" ],
      "description" : "CMP sub-categorization of the job that produces this extract file."
    },
    "version" : {
      "type" : "number",
      "minimum" : 1.0,
      "maximum" : 1.0,
      "description" : "The current version of the generic extract file. This must match the corresponding outbound file."
    },
    "transformDateTime" : {
      "type" : "string",
      "format" : "date-time",
      "description" : "Timestamp indicating when the third-party response file was transformed into the CMP generic format."
    },
    "transmitDateTime" : {
      "type" : "string",
      "format" : "date-time",
      "description" : "Timestamp indicating when the response file was received from the third-party system."
    },
    "externalFileName" : {
      "type" : "string",
      "pattern" : "^([a-zA-Z0-9._-])+$",
      "maxLength" : 20,
      "description" : "The name of the file that was received from the external system."
    },
    "details" : {
      "type" : "array",
      "items" : {
        "$ref" : "#/definitions/Detail"
      }
    }
  },
  "required" : [ "interfaceCategory", "interfaceType", "version", "externalFileName", "details" ],
  "definitions" : {
    "Detail" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "detailSequence" : {
          "type" : "integer",
          "minimum" : 0,
          "description" : "Unique identifier of the detail record within the current extract. Starts at 1 and incremented for each detail record"
        },
        "customerLevel" : {
          "type" : "string",
          "enum" : [ "S", "A" ],
          "description" : "Charge event related customer level. e.g: S = Subscription, A = Account."
        },
        "customerReference" : {
          "type" : "string",
          "maxLength" : 25,
          "description" : "Reference of the charge event related customer"
        },
        "billImmediately" : {
          "type" : "boolean",
          "description" : "use to indicate if there is a charge/credit to be applied on next run of Invoice Production or wait until cycle"
        },
        "externalChargeIdentifier" : {
          "type" : "string",
          "maxLength" : 50,
          "description" : "Mapped to CMP Service Code, value will be stored in external reference field on IBD table, the CMP service code can be stored in the internal reference field "
        },
        "externalChargeDescription" : {
          "type" : "string",
          "maxLength" : 30,
          "description" : "Used to override a subscription service description"
        },
        "chargeStartDateTime" : {
          "type" : "string",
          "format" : "date-time",
          "description" : "Start date and time of the particular charge event"
        },
        "chargeEndDateTime" : {
          "type" : "string",
          "format" : "date-time",
          "description" : "Charge event's end date and time"
        },
        "price" : {
          "type" : "number",
          "minimum" : 0.0,
          "maximum" : 9.9999999999E8,
          "description" : "Price of the charge event"
        },
        "uniqueReference" : {
          "type" : "string",
          "maxLength" : 50,
          "description" : "Reference of the external reference "
        }
      },
      "required" : [ "detailSequence", "customerLevel", "customerReference", "externalChargeIdentifier", "chargeStartDateTime", "uniqueReference" ]
    }
  }
}